#include "NonFinAutToRegGrammaticaTest.h"

NonFinAutToRegGrammaticaTest::NonFinAutToRegGrammaticaTest()
{
}

NonFinAutToRegGrammaticaTest::~NonFinAutToRegGrammaticaTest()
{
}

void NonFinAutToRegGrammaticaTest::testProgram()
{
	cout <<endl;
	cout<<"NDFA To Regular Grammatica"<<endl << "==================================="<<endl<<endl;

	list<string> finishList;
	list<string> startList;
	startList.push_front("q0");
	finishList.push_front("q0");
	finishList.push_front("q4");
	NonFinAut<string> nonFinAut(startList, finishList);
	nonFinAut.addTransition("q0", 'a', "q4");
	nonFinAut.addTransition("q0", 'b', "q4");
	nonFinAut.addTransition("q0", 'a', "q1");
	nonFinAut.addTransition("q0", 'b', "q2");
	nonFinAut.addTransition("q1", 'a', "q1");
	nonFinAut.addTransition("q1", 'b', "q3");
	nonFinAut.addTransition("q1", 'a', "q4");
	nonFinAut.addTransition("q1", 'b', "q4");
	nonFinAut.addTransition("q2", 'a', "q1");
	nonFinAut.addTransition("q2", 'b', "q3");
	nonFinAut.addTransition("q2", 'a', "q4");
	nonFinAut.addTransition("q2", 'b', "q4");
	nonFinAut.addTransition("q3", 'a', "q1");
	nonFinAut.addTransition("q3", 'a', "q4");
	nonFinAut.printLanguage(3);
	
	cout << "" <<endl;

	NonFinAutToRegGrammatica regGramTest;
	RegGrammatica<string> regGram = regGramTest.nonFinAutToRegGrammatica(nonFinAut);
	cout << "The Regular Grammatica" <<endl;
	regGram.printLanguage(3);
	regGram.printProdRules();
}
